 pa。p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'pckage util;

import java.util.HashMap;
import java.util.Map;

import javax.persistence.CacheRetrieveMode;
import javax.persistence.CacheStoreMode;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

public class EntityManagerUtil {
	private static final EntityManagerFactory entityManagerFactory;
	static {
		try {

			entityManagerFactory = Persistence.createEntityManagerFactory("Tourism");
			Map<String, Object> hints = new HashMap<>();
			hints.put("javax.persistence.cache.storeMode", CacheStoreMode.REFRESH);

		} catch (ExceptionInInitializerError ex) {
			System.err.println("123" + ex);
			throw new ExceptionInInitializerError(ex);
		}
	}

	public static EntityManager getEntityManager() {
		return entityManagerFactory.createEntityManager();

	}
}